﻿Imports AugmentLib.Database
Imports System.Configuration.ConfigurationManager
Imports AugmentLib.InputOutput.Encryption
Imports AugmentLib.WebComponent

Partial Class StransCompare
    Inherits System.Web.UI.Page

    Private Sub GetAllTransactionDate(ByVal TransactionUID As Guid)

        Dim objDB As New Database(AppSettings("datasource"), AppSettings("database"), AppSettings("username"), AppSettings("password"), AppSettings("timeout"), AppSettings("pooling"))
        Dim TempDT As New Data.DataTable

        objDB.OpenConnection()
        objDB.dbVariable.SQLString = "SELECT CONVERT(VARCHAR(20), CreateDate, 100) as CreateDate,OId FROM " + AppSettings("logdatasource").ToString() + ".dbo.AW_SaleTransaction WHERE TransactionId=@TransactionId"
        objDB.AddParameter("TransactionId", Data.SqlDbType.UniqueIdentifier, TransactionUID)
        objDB.FillData(TempDT, "SaleTransaction", Database.SQLCommandType.NormalString)
        objDB.CloseConnection()

        Dim NewRow As Data.DataRow
        NewRow = TempDT.NewRow
        NewRow.Item("CreateDate") = "--Select One--"
        NewRow.Item("OId") = Guid.Empty
        TempDT.Rows.InsertAt(NewRow, 0)

        ddlTransaction1.DataSource = TempDT
        ddlTransaction1.DataTextField = "CreateDate"
        ddlTransaction1.DataValueField = "OId"
        ddlTransaction1.DataBind()

        ddlTransaction2.DataSource = TempDT
        ddlTransaction2.DataTextField = "CreateDate"
        ddlTransaction2.DataValueField = "OId"
        ddlTransaction2.DataBind()

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Session("StaffId") Is Nothing Then
            Response.Redirect("Default.aspx")
        ElseIf Session.Item("StaffType").ToString = "2" Then
            Response.Redirect("Default.aspx")
        Else
            lblStaffUID.Text = Session("StaffId").ToString
        End If

        If Not Page.IsPostBack Then
            If Not Request.QueryString("id") Is Nothing Then
                Dim Propertyid As String
                Propertyid = SymmetricDecryptFromHex(Request.QueryString("id"), "augment")
                GetAllTransactionDate(New Guid(Propertyid))
            End If
        End If

    End Sub

    Protected Sub ddlTransaction2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlTransaction2.SelectedIndexChanged
        If ddlTransaction2.SelectedValue <> Guid.Empty.ToString Then
            Dim objDB As New Database(AppSettings("datasource"), AppSettings("database"), AppSettings("username"), AppSettings("password"), AppSettings("timeout"), AppSettings("pooling"))
            Dim TempDT As New Data.DataTable

            objDB.OpenConnection()
            objDB.dbVariable.SQLString = "SELECT p.Project, isnull(a.UnitNumber,'') + ', ' + isnull(r.Road,'') + ', ' + isnull(l.Location,'') + ', ' + isnull(s.State,'') + ', ' + isnull(c.Country,'') as 'Address', " & _
                                   "st.OpenFileRef, st.CloseFileRef, st.InvoiceNumber, st.TransListType, st.TransactedPrice, " & _
                                   "st.Deposit, st.PaymentType, st.PaymentDate, st.Requisition, st.Status, st.VendorType, " & _
                                   "st.VendorName1, st.VendorName2, st.VendorName3, st.VendorCompany, st.VendorNRIC1, st.VendorNRIC2, " & _
                                   "st.VendorNRIC3, st.VendorCompanyNo, st.VendorContactPerson, st.VendorAddress, st.VendorPhone, " & _
                                   "st.VendorMobile, st.VendorFax, st.VendorEmail, st.VendorReferral, st.VendorReferralName, " & _
                                   "st.VendorReferralNRIC, st.VendorReferralContact, st.VendorReferralStatus, st.VendorReferralAmount, " & _
                                   "st.AgencyFee, st.GST, st.GSTPaidBy, st.ListingFee, st.VendorSolicitorCompany, st.VendorSolicitorName,  " & _
                                   "st.VendorSolicitorEmail, st.VendorSolicitorAddress, st.VendorSolicitorPhone, st.VendorSolicitorFax, " & _
                                   "st.PurchaserType, st.PurchaserName1, st.PurchaserName2, st.PurchaserName3, st.PurchaserCompany, st.PurchaserNRIC1, " & _
                                   "st.PurchaserNRIC2, st.PurchaserNRIC3, st.PurchaserCompanyNo, st.PurchaserContactPerson, st.PurchaserAddress, " & _
                                   "st.PurchaserPhone, st.PurchaserMobile, st.PurchaserFax, st.PurchaserEmail, st.PurchaserReferral, " & _
                                   "st.PurchaserReferralName, st.PurchaserReferralNRIC, st.PurchaserReferralContact, st.PurchaserReferralStatus, " & _
                                   "st.PurchaserReferralAmount, st.DisbursementFee, st.PurchaserSolicitorCompany, st.PurchaserSolicitorName, " & _
                                   "st.PurchaserSolicitorEmail, st.PurchaserSolicitorAddress, st.PurchaserSolicitorPhone, st.PurchaserSolicitorFax, " & _
                                   "st.SignDate, st.SignRemark, st.SignComplete, scb.Name as SignCompleteBy, scb.Name as SignCompleteByInitial, st.SignCompleteDate, st.SNPDate, " & _
                                   "st.CollectDate, st.CollectAmt, st.CollectComplete, st.CollectRemark, ccb.Name as CollectCompleteBy, ccb.Initial as CollectCompleteByInitial, st.CollectCompleteDate, " & _
                                   "st.UndoDate, st.UndoRemark, st.UndoAmt, ub.Name as UndoBy, ub.Initial as UndoByInitial, st.UndoAgencyFee, st.UndoGST, st.UndoGSTPaidBy, st.UndoListerAmt " & _
                                   "FROM " + AppSettings("logdatasource").ToString() + ".dbo.AW_SaleTransaction st LEFT OUTER JOIN AW_Property a ON st.PropertyId=a.PropertyId LEFT OUTER JOIN " & _
                                   "AW_Road r ON a.RoadId = r.RoadId LEFT OUTER JOIN AW_Project p ON a.ProjectId = p.ProjectId " & _
                                   "LEFT OUTER JOIN AW_Location l ON r.LocationId = l.LocationId LEFT OUTER JOIN AW_State s ON l.StateId = s.StateId " & _
                                   "LEFT OUTER JOIN AW_Country c on s.CountryId = c.CountryId LEFT OUTER JOIN AW_Staff scb ON st.SignCompleteBy=scb.StaffId " & _
                                   "LEFT OUTER JOIN AW_Staff ccb ON st.CollectCompleteBy= ccb.StaffId LEFT OUTER JOIN AW_Staff ub ON " & _
                                   "st.UndoBy=ub.StaffId WHERE st.OId = @OId"
            objDB.AddParameter("OID", Data.SqlDbType.UniqueIdentifier, New Guid(ddlTransaction2.SelectedValue))
            objDB.FillData(TempDT, "Transaction", Database.SQLCommandType.NormalString)
            objDB.CloseConnection()

            For Each ReadRow As Data.DataRow In TempDT.Rows

                lblAddress2.Text = ReadRow.Item("Address").ToString
                lblProject2.Text = ReadRow.Item("Project").ToString
                lblOpenFileRef2.Text = ReadRow.Item("OpenFileRef").ToString
                lblClosedFileRef2.Text = ReadRow.Item("CloseFileRef").ToString
                lblInvoiceNum2.Text = ReadRow.Item("InvoiceNumber").ToString
                If ReadRow.Item("TransListType").ToString = "1" Then
                    lblTransactAs2.Text = "SR"
                ElseIf ReadRow.Item("TransListType").ToString = "2" Then
                    lblTransactAs2.Text = "SC"
                ElseIf ReadRow.Item("TransListType").ToString = "3" Then
                    lblTransactAs2.Text = "SL"
                ElseIf ReadRow.Item("TransListType").ToString = "4" Then
                    lblTransactAs2.Text = "SI"
                Else
                    lblTransactAs2.Text = ""
                End If
                lblTransactedPrice2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("TransactedPrice"))
                lblDeposit2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("Deposit"))
                If ReadRow.Item("PaymentType").ToString = "1" Then
                    lblPaymentType2.Text = "Cash"
                ElseIf ReadRow.Item("PaymentType").ToString = "2" Then
                    lblPaymentType2.Text = "Cheque"
                ElseIf ReadRow.Item("PaymentType").ToString = "3" Then
                    lblPaymentType2.Text = "Transfer"
                Else
                    lblPaymentType2.Text = ""
                End If
                If ReadRow.Item("PaymentDate").ToString = "" Then
                    lblPaymentDate2.Text = ""
                Else
                    lblPaymentDate2.Text = Format(ReadRow.Item("PaymentDate"), "dd-MMM-yyyy")
                End If
                lblRequisition2.Text = ReadRow.Item("Requisition").ToString
                If ReadRow.Item("Status").ToString = "0" Then
                    lblStatus2.Text = "New"
                ElseIf ReadRow.Item("Status").ToString = "1" Then
                    lblStatus2.Text = "Pending Signing"
                ElseIf ReadRow.Item("Status").ToString = "2" Then
                    lblStatus2.Text = "Pending Collection"
                ElseIf ReadRow.Item("Status").ToString = "3" Then
                    lblStatus2.Text = "Completed"
                ElseIf ReadRow.Item("Status").ToString = "4" Then
                    lblStatus2.Text = "Relist"
                Else
                    lblStatus2.Text = ""
                End If

                If ReadRow.Item("VendorType").ToString = "0" Then
                    lblVendorType2.Text = "Own"
                ElseIf ReadRow.Item("VendorType").ToString = "1" Then
                    lblVendorType2.Text = "Company"
                Else
                    lblVendorType2.Text = ""
                End If
                lblVendorName12.Text = ReadRow.Item("VendorName1").ToString
                lblVendorName22.Text = ReadRow.Item("VendorName2").ToString
                lblVendorName32.Text = ReadRow.Item("VendorName3").ToString
                lblVendorCompany2.Text = ReadRow.Item("VendorCompany").ToString
                lblVendorNRIC12.Text = ReadRow.Item("VendorNRIC1").ToString
                lblVendorNRIC22.Text = ReadRow.Item("VendorNRIC2").ToString
                lblVendorNRIC32.Text = ReadRow.Item("VendorNRIC3").ToString
                lblVendorCompanyNo2.Text = ReadRow.Item("VendorCompanyNo").ToString
                lblVendorContactPerson2.Text = ReadRow.Item("VendorContactPerson").ToString
                lblVendorAddress2.Text = ReadRow.Item("VendorAddress").ToString
                lblVendorPhone2.Text = ReadRow.Item("VendorPhone").ToString
                lblVendorMobile2.Text = ReadRow.Item("VendorMobile").ToString
                lblVendorFax2.Text = ReadRow.Item("VendorFax").ToString
                lblVendorEmail2.Text = ReadRow.Item("VendorEmail").ToString
                If ReadRow.Item("VendorReferral").ToString = "1" Then
                    lblVendorReferral2.Text = "☑"
                Else
                    lblVendorReferral2.Text = ""
                End If
                lblVendorReferralName2.Text = ReadRow.Item("VendorReferralName").ToString
                lblVendorReferralNRIC2.Text = ReadRow.Item("VendorReferralNRIC").ToString
                lblVendorReferralContact2.Text = ReadRow.Item("VendorReferralContact").ToString
                If ReadRow.Item("VendorReferralStatus").ToString = "1" Then
                    lblVendorReferralStatus2.Text = "Vendor"
                ElseIf ReadRow.Item("VendorReferralStatus").ToString = "2" Then
                    lblVendorReferralStatus2.Text = "Purchaser"
                Else
                    lblVendorReferralStatus2.Text = ""
                End If
                lblVendorReferralAmount2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("VendorReferralAmount"))
                lblAgencyFee2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("AgencyFee"))
                If ReadRow.Item("GSTPaidBy").ToString = "1" Then
                    lblGSTPaidBy2.Text = "Vendor"
                ElseIf ReadRow.Item("GSTPaidBy").ToString = "2" Then
                    lblGSTPaidBy2.Text = "Company"
                Else
                    lblGSTPaidBy2.Text = ""
                End If
                lblListing2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("ListingFee"))
                lblVendorSolicitorCompany2.Text = ReadRow.Item("VendorSolicitorCompany").ToString
                lblVendorSolicitorName2.Text = ReadRow.Item("VendorSolicitorName").ToString
                lblVendorSolicitorEmail2.Text = ReadRow.Item("VendorSolicitorEmail").ToString
                lblVendorSolicitorAddress2.Text = ReadRow.Item("VendorSolicitorAddress").ToString
                lblVendorSolicitorPhone2.Text = ReadRow.Item("VendorSolicitorPhone").ToString
                lblVendorSolicitorFax2.Text = ReadRow.Item("VendorSolicitorFax").ToString

                If ReadRow.Item("PurchaserType").ToString = "0" Then
                    lblPurchaserType2.Text = "Own"
                ElseIf ReadRow.Item("PurchaserType").ToString = "1" Then
                    lblPurchaserType2.Text = "Company"
                Else
                    lblPurchaserType2.Text = ""
                End If
                lblPurchaserName12.Text = ReadRow.Item("PurchaserName1").ToString
                lblPurchaserName22.Text = ReadRow.Item("PurchaserName2").ToString
                lblPurchaserName32.Text = ReadRow.Item("PurchaserName3").ToString
                lblPurchaserCompany2.Text = ReadRow.Item("PurchaserCompany").ToString
                lblPurchaserNRIC12.Text = ReadRow.Item("PurchaserNRIC1").ToString
                lblPurchaserNRIC22.Text = ReadRow.Item("PurchaserNRIC2").ToString
                lblPurchaserNRIC32.Text = ReadRow.Item("PurchaserNRIC3").ToString
                lblPurchaserCompanyNo2.Text = ReadRow.Item("PurchaserCompanyNo").ToString
                lblPurchaserContactPerson2.Text = ReadRow.Item("PurchaserContactPerson").ToString
                lblPurchaserAddress2.Text = ReadRow.Item("PurchaserAddress").ToString
                lblPurchaserPhone2.Text = ReadRow.Item("PurchaserPhone").ToString
                lblPurchaserMobile2.Text = ReadRow.Item("PurchaserMobile").ToString
                lblPurchaserFax2.Text = ReadRow.Item("PurchaserFax").ToString
                lblPurchaserEmail2.Text = ReadRow.Item("PurchaserEmail").ToString
                If ReadRow.Item("PurchaserReferral").ToString = "1" Then
                    lblPurchaserReferral2.Text = "☑"
                Else
                    lblPurchaserReferral2.Text = ""
                End If
                lblPurchaserReferralName2.Text = ReadRow.Item("PurchaserReferralName").ToString
                lblPurchaserReferralNRIC2.Text = ReadRow.Item("PurchaserReferralNRIC").ToString
                lblPurchaserReferralContact2.Text = ReadRow.Item("PurchaserReferralContact").ToString
                If ReadRow.Item("PurchaserReferralStatus").ToString = "1" Then
                    lblPurchaserReferralStatus2.Text = "Purchaser"
                ElseIf ReadRow.Item("PurchaserReferralStatus").ToString = "2" Then
                    lblPurchaserReferralStatus2.Text = "Vendor"
                Else
                    lblPurchaserReferralStatus2.Text = ""
                End If
                lblPurchaserReferralAmount2.Text = ReadRow.Item("PurchaserReferralAmount").ToString
                lblDisbursementFee2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("DisbursementFee"))
                lblPurchaserSolicitorCompany2.Text = ReadRow.Item("PurchaserSolicitorCompany").ToString
                lblPurchaserSolicitorName2.Text = ReadRow.Item("PurchaserSolicitorName").ToString
                lblPurchaserSolicitorEmail2.Text = ReadRow.Item("PurchaserSolicitorEmail").ToString
                lblPurchaserSolicitorAddress2.Text = ReadRow.Item("PurchaserSolicitorAddress").ToString
                lblPurchaserSolicitorPhone2.Text = ReadRow.Item("PurchaserSolicitorPhone").ToString
                lblPurchaserSolicitorFax2.Text = ReadRow.Item("PurchaserSolicitorFax").ToString

                If ReadRow.Item("SignDate").ToString = "" Then
                    lblSignDate2.Text = ""
                Else
                    lblSignDate2.Text = Format(ReadRow.Item("SignDate"), "dd-MMM-yyyy")
                End If
                lblSignRemark2.Text = ReadRow.Item("SignRemark").ToString
                If ReadRow.Item("SignComplete").ToString = "1" Then
                    lblSignCompletion2.Text = "☑"
                Else
                    lblSignCompletion2.Text = ""
                End If
                lblSignCompletionBy2.Text = ReadRow.Item("SignCompleteByInitial").ToString
                'lblSignCompletionBy2.Text = ReadRow.Item("SignCompleteBy").ToString
                If ReadRow.Item("SignCompleteDate").ToString = "" Then
                    lblSignCompletionDate2.Text = ""
                Else
                    lblSignCompletionDate2.Text = Format(ReadRow.Item("SignCompleteDate"), "dd-MMM-yyyy")
                End If
                If ReadRow.Item("SNPDate").ToString = "" Then
                    lblSNPDate2.Text = ""
                Else
                    lblSNPDate2.Text = Format(ReadRow.Item("SNPDate"), "dd-MMM-yyyy")
                End If

                If ReadRow.Item("CollectDate").ToString = "" Then
                    lblCollectionDate2.Text = ""
                Else
                    lblCollectionDate2.Text = Format(ReadRow.Item("CollectDate"), "dd-MMM-yyyy")
                End If
                If IsDBNull(ReadRow.Item("CollectAmt")) Then
                    lblCollectedAmount2.Text = ""
                Else
                    lblCollectedAmount2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("CollectAmt"))
                End If

                lblCollectionRemark2.Text = ReadRow.Item("CollectRemark").ToString
                If ReadRow.Item("CollectComplete").ToString = "1" Then
                    lblCollectionCompletion2.Text = "☑"
                Else
                    lblCollectionCompletion2.Text = ""
                End If
                'lblCollectionCompletionBy2.Text = ReadRow.Item("CollectCompleteBy").ToString
                lblCollectionCompletionBy2.Text = ReadRow.Item("CollectCompleteByInitial").ToString
                If ReadRow.Item("CollectCompleteDate").ToString = "" Then
                    lblCollectionCompletionDate2.Text = ""
                Else
                    lblCollectionCompletionDate2.Text = Format(ReadRow.Item("CollectCompleteDate"), "dd-MMM-yyyy")
                End If

                If ReadRow.Item("UndoDate").ToString = "" Then
                    lblUndoDate2.Text = ""
                Else
                    lblUndoDate2.Text = Format(ReadRow.Item("UndoDate"), "dd-MMM-yyyy")
                End If
                lblUndoRemark2.Text = ReadRow.Item("UndoRemark").ToString
                If IsDBNull(ReadRow.Item("UndoAmt")) Then
                    lblUndoAmt2.Text = ""
                Else
                    lblUndoAmt2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoAmt"))
                End If
                'lblUndoBy2.Text = ReadRow.Item("UndoBy").ToString
                lblUndoBy2.Text = ReadRow.Item("UndoByInitial").ToString
                If IsDBNull(ReadRow.Item("UndoAgencyFee")) Then
                    lblUndoAgencyFee2.Text = ""
                Else
                    lblUndoAgencyFee2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoAgencyFee"))
                End If
                If IsDBNull(ReadRow.Item("UndoGST")) Then
                    lblUndoGST2.Text = ""
                Else
                    lblUndoGST2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoGST"))
                End If
                If ReadRow.Item("UndoGSTPaidBy").ToString = "1" Then
                    lblUndoGSTPaidBy2.Text = "Landlord"
                ElseIf ReadRow.Item("UndoGSTPaidBy").ToString = "2" Then
                    lblUndoGSTPaidBy2.Text = "Company"
                Else
                    lblUndoGSTPaidBy2.Text = ""
                End If
                If IsDBNull(ReadRow.Item("UndoListerAmt")) Then
                    lblUndoListerAmount2.Text = ""
                Else
                    lblUndoListerAmount2.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoListerAmt"))
                End If
            Next

            If ddlTransaction1.SelectedValue <> Guid.Empty.ToString Then
                Comparison()
            End If
        End If
    End Sub

    Protected Sub ddlTransaction1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlTransaction1.SelectedIndexChanged
        If ddlTransaction1.SelectedValue <> Guid.Empty.ToString Then
            Dim objDB As New Database(AppSettings("datasource"), AppSettings("database"), AppSettings("username"), AppSettings("password"), AppSettings("timeout"), AppSettings("pooling"))
            Dim TempDT As New Data.DataTable

            objDB.OpenConnection()
            objDB.dbVariable.SQLString = "SELECT p.Project, isnull(a.UnitNumber,'') + ', ' + isnull(r.Road,'') + ', ' + isnull(l.Location,'') + ', ' + isnull(s.State,'') + ', ' + isnull(c.Country,'') as 'Address', " & _
                                   "st.OpenFileRef, st.CloseFileRef, st.InvoiceNumber, st.TransListType, st.TransactedPrice, " & _
                                   "st.Deposit, st.PaymentType, st.PaymentDate, st.Requisition, st.Status, st.VendorType, " & _
                                   "st.VendorName1, st.VendorName2, st.VendorName3, st.VendorCompany, st.VendorNRIC1, st.VendorNRIC2, " & _
                                   "st.VendorNRIC3, st.VendorCompanyNo, st.VendorContactPerson, st.VendorAddress, st.VendorPhone, " & _
                                   "st.VendorMobile, st.VendorFax, st.VendorEmail, st.VendorReferral, st.VendorReferralName, " & _
                                   "st.VendorReferralNRIC, st.VendorReferralContact, st.VendorReferralStatus, st.VendorReferralAmount, " & _
                                   "st.AgencyFee, st.GST, st.GSTPaidBy, st.ListingFee, st.VendorSolicitorCompany, st.VendorSolicitorName,  " & _
                                   "st.VendorSolicitorEmail, st.VendorSolicitorAddress, st.VendorSolicitorPhone, st.VendorSolicitorFax, " & _
                                   "st.PurchaserType, st.PurchaserName1, st.PurchaserName2, st.PurchaserName3, st.PurchaserCompany, st.PurchaserNRIC1, " & _
                                   "st.PurchaserNRIC2, st.PurchaserNRIC3, st.PurchaserCompanyNo, st.PurchaserContactPerson, st.PurchaserAddress, " & _
                                   "st.PurchaserPhone, st.PurchaserMobile, st.PurchaserFax, st.PurchaserEmail, st.PurchaserReferral, " & _
                                   "st.PurchaserReferralName, st.PurchaserReferralNRIC, st.PurchaserReferralContact, st.PurchaserReferralStatus, " & _
                                   "st.PurchaserReferralAmount, st.DisbursementFee, st.PurchaserSolicitorCompany, st.PurchaserSolicitorName, " & _
                                   "st.PurchaserSolicitorEmail, st.PurchaserSolicitorAddress, st.PurchaserSolicitorPhone, st.PurchaserSolicitorFax, " & _
                                   "st.SignDate, st.SignRemark, st.SignComplete, scb.Name as SignCompleteBy, scb.Initial as SignCompleteByInitial, st.SignCompleteDate, st.SNPDate, " & _
                                   "st.CollectDate, st.CollectAmt, st.CollectComplete, st.CollectRemark, ccb.Name as CollectCompleteBy, ccb.Initial as CollectCompleteByInitial, st.CollectCompleteDate, " & _
                                   "st.UndoDate, st.UndoRemark, st.UndoAmt, ub.Name as UndoBy, ub.Initial as UndoByInitial, st.UndoAgencyFee, st.UndoGST, st.UndoGSTPaidBy, st.UndoListerAmt " & _
                                   "FROM " + AppSettings("logdatasource").ToString() + ".dbo.AW_SaleTransaction st LEFT OUTER JOIN AW_Property a ON st.PropertyId=a.PropertyId LEFT OUTER JOIN " & _
                                   "AW_Road r ON a.RoadId = r.RoadId LEFT OUTER JOIN AW_Project p ON a.ProjectId = p.ProjectId " & _
                                   "LEFT OUTER JOIN AW_Location l ON r.LocationId = l.LocationId LEFT OUTER JOIN AW_State s ON l.StateId = s.StateId " & _
                                   "LEFT OUTER JOIN AW_Country c on s.CountryId = c.CountryId LEFT OUTER JOIN AW_Staff scb ON st.SignCompleteBy=scb.StaffId " & _
                                   "LEFT OUTER JOIN AW_Staff ccb ON st.CollectCompleteBy= ccb.StaffId LEFT OUTER JOIN AW_Staff ub ON " & _
                                   "st.UndoBy=ub.StaffId WHERE st.OId = @OId"
            objDB.AddParameter("OID", Data.SqlDbType.UniqueIdentifier, New Guid(ddlTransaction1.SelectedValue))
            objDB.FillData(TempDT, "Transaction", Database.SQLCommandType.NormalString)
            objDB.CloseConnection()

            For Each ReadRow As Data.DataRow In TempDT.Rows

                lblAddress1.Text = ReadRow.Item("Address").ToString
                lblProject1.Text = ReadRow.Item("Project").ToString
                lblOpenFileRef1.Text = ReadRow.Item("OpenFileRef").ToString
                lblClosedFileRef1.Text = ReadRow.Item("CloseFileRef").ToString
                lblInvoiceNum1.Text = ReadRow.Item("InvoiceNumber").ToString
                If ReadRow.Item("TransListType").ToString = "1" Then
                    lblTransactAs1.Text = "SR"
                ElseIf ReadRow.Item("TransListType").ToString = "2" Then
                    lblTransactAs1.Text = "SC"
                ElseIf ReadRow.Item("TransListType").ToString = "3" Then
                    lblTransactAs1.Text = "SL"
                ElseIf ReadRow.Item("TransListType").ToString = "4" Then
                    lblTransactAs1.Text = "SI"
                Else
                    lblTransactAs1.Text = ""
                End If
                lblTransactedPrice1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("TransactedPrice"))
                lblDeposit1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("Deposit"))
                If ReadRow.Item("PaymentType").ToString = "1" Then
                    lblPaymentType1.Text = "Cash"
                ElseIf ReadRow.Item("PaymentType").ToString = "2" Then
                    lblPaymentType1.Text = "Cheque"
                ElseIf ReadRow.Item("PaymentType").ToString = "3" Then
                    lblPaymentType1.Text = "Transfer"
                Else
                    lblPaymentType1.Text = ""
                End If
                If ReadRow.Item("PaymentDate").ToString = "" Then
                    lblPaymentDate1.Text = ""
                Else
                    lblPaymentDate1.Text = Format(ReadRow.Item("PaymentDate"), "dd-MMM-yyyy")
                End If
                lblRequisition1.Text = ReadRow.Item("Requisition").ToString
                If ReadRow.Item("Status").ToString = "0" Then
                    lblStatus1.Text = "New"
                ElseIf ReadRow.Item("Status").ToString = "1" Then
                    lblStatus1.Text = "Pending Signing"
                ElseIf ReadRow.Item("Status").ToString = "2" Then
                    lblStatus1.Text = "Pending Collection"
                ElseIf ReadRow.Item("Status").ToString = "3" Then
                    lblStatus1.Text = "Completed"
                ElseIf ReadRow.Item("Status").ToString = "4" Then
                    lblStatus1.Text = "Relist"
                Else
                    lblStatus1.Text = ""
                End If

                If ReadRow.Item("VendorType").ToString = "0" Then
                    lblVendorType1.Text = "Own"
                ElseIf ReadRow.Item("VendorType").ToString = "1" Then
                    lblVendorType1.Text = "Company"
                Else
                    lblVendorType1.Text = ""
                End If
                lblVendorName11.Text = ReadRow.Item("VendorName1").ToString
                lblVendorName21.Text = ReadRow.Item("VendorName2").ToString
                lblVendorName31.Text = ReadRow.Item("VendorName3").ToString
                lblVendorCompany1.Text = ReadRow.Item("VendorCompany").ToString
                lblVendorNRIC11.Text = ReadRow.Item("VendorNRIC1").ToString
                lblVendorNRIC21.Text = ReadRow.Item("VendorNRIC2").ToString
                lblVendorNRIC31.Text = ReadRow.Item("VendorNRIC3").ToString
                lblVendorCompanyNo1.Text = ReadRow.Item("VendorCompanyNo").ToString
                lblVendorContactPerson1.Text = ReadRow.Item("VendorContactPerson").ToString
                lblVendorAddress1.Text = ReadRow.Item("VendorAddress").ToString
                lblVendorPhone1.Text = ReadRow.Item("VendorPhone").ToString
                lblVendorMobile1.Text = ReadRow.Item("VendorMobile").ToString
                lblVendorFax1.Text = ReadRow.Item("VendorFax").ToString
                lblVendorEmail1.Text = ReadRow.Item("VendorEmail").ToString
                If ReadRow.Item("VendorReferral").ToString = "1" Then
                    lblVendorReferral1.Text = "☑"
                Else
                    lblVendorReferral1.Text = ""
                End If
                lblVendorReferralName1.Text = ReadRow.Item("VendorReferralName").ToString
                lblVendorReferralNRIC1.Text = ReadRow.Item("VendorReferralNRIC").ToString
                lblVendorReferralContact1.Text = ReadRow.Item("VendorReferralContact").ToString
                If ReadRow.Item("VendorReferralStatus").ToString = "1" Then
                    lblVendorReferralStatus1.Text = "Vendor"
                ElseIf ReadRow.Item("VendorReferralStatus").ToString = "2" Then
                    lblVendorReferralStatus1.Text = "Purchaser"
                Else
                    lblVendorReferralStatus1.Text = ""
                End If
                lblVendorReferralAmount1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("VendorReferralAmount"))
                lblAgencyFee1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("AgencyFee"))
                If ReadRow.Item("GSTPaidBy").ToString = "1" Then
                    lblGSTPaidBy1.Text = "Vendor"
                ElseIf ReadRow.Item("GSTPaidBy").ToString = "2" Then
                    lblGSTPaidBy1.Text = "Company"
                Else
                    lblGSTPaidBy1.Text = ""
                End If
                lblListing1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("ListingFee"))
                lblVendorSolicitorCompany1.Text = ReadRow.Item("VendorSolicitorCompany").ToString
                lblVendorSolicitorName1.Text = ReadRow.Item("VendorSolicitorName").ToString
                lblVendorSolicitorEmail1.Text = ReadRow.Item("VendorSolicitorEmail").ToString
                lblVendorSolicitorAddress1.Text = ReadRow.Item("VendorSolicitorAddress").ToString
                lblVendorSolicitorPhone1.Text = ReadRow.Item("VendorSolicitorPhone").ToString
                lblVendorSolicitorFax1.Text = ReadRow.Item("VendorSolicitorFax").ToString

                If ReadRow.Item("PurchaserType").ToString = "0" Then
                    lblPurchaserType1.Text = "Own"
                ElseIf ReadRow.Item("PurchaserType").ToString = "1" Then
                    lblPurchaserType1.Text = "Company"
                Else
                    lblPurchaserType1.Text = ""
                End If
                lblPurchaserName11.Text = ReadRow.Item("PurchaserName1").ToString
                lblPurchaserName21.Text = ReadRow.Item("PurchaserName2").ToString
                lblPurchaserName31.Text = ReadRow.Item("PurchaserName3").ToString
                lblPurchaserCompany1.Text = ReadRow.Item("PurchaserCompany").ToString
                lblPurchaserNRIC11.Text = ReadRow.Item("PurchaserNRIC1").ToString
                lblPurchaserNRIC21.Text = ReadRow.Item("PurchaserNRIC2").ToString
                lblPurchaserNRIC31.Text = ReadRow.Item("PurchaserNRIC3").ToString
                lblPurchaserCompanyNo1.Text = ReadRow.Item("PurchaserCompanyNo").ToString
                lblPurchaserContactPerson1.Text = ReadRow.Item("PurchaserContactPerson").ToString
                lblPurchaserAddress1.Text = ReadRow.Item("PurchaserAddress").ToString
                lblPurchaserPhone1.Text = ReadRow.Item("PurchaserPhone").ToString
                lblPurchaserMobile1.Text = ReadRow.Item("PurchaserMobile").ToString
                lblPurchaserFax1.Text = ReadRow.Item("PurchaserFax").ToString
                lblPurchaserEmail1.Text = ReadRow.Item("PurchaserEmail").ToString
                If ReadRow.Item("PurchaserReferral").ToString = "1" Then
                    lblPurchaserReferral1.Text = "☑"
                Else
                    lblPurchaserReferral1.Text = ""
                End If
                lblPurchaserReferralName1.Text = ReadRow.Item("PurchaserReferralName").ToString
                lblPurchaserReferralNRIC1.Text = ReadRow.Item("PurchaserReferralNRIC").ToString
                lblPurchaserReferralContact1.Text = ReadRow.Item("PurchaserReferralContact").ToString
                If ReadRow.Item("PurchaserReferralStatus").ToString = "1" Then
                    lblPurchaserReferralStatus1.Text = "Purchaser"
                ElseIf ReadRow.Item("PurchaserReferralStatus").ToString = "2" Then
                    lblPurchaserReferralStatus1.Text = "Vendor"
                Else
                    lblPurchaserReferralStatus1.Text = ""
                End If
                lblPurchaserReferralAmount1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("PurchaserReferralAmount"))
                lblDisbursementFee1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("DisbursementFee"))
                lblPurchaserSolicitorCompany1.Text = ReadRow.Item("PurchaserSolicitorCompany").ToString
                lblPurchaserSolicitorName1.Text = ReadRow.Item("PurchaserSolicitorName").ToString
                lblPurchaserSolicitorEmail1.Text = ReadRow.Item("PurchaserSolicitorEmail").ToString
                lblPurchaserSolicitorAddress1.Text = ReadRow.Item("PurchaserSolicitorAddress").ToString
                lblPurchaserSolicitorPhone1.Text = ReadRow.Item("PurchaserSolicitorPhone").ToString
                lblPurchaserSolicitorFax1.Text = ReadRow.Item("PurchaserSolicitorFax").ToString


                If ReadRow.Item("SignDate").ToString = "" Then
                    lblSignDate1.Text = ""
                Else
                    lblSignDate1.Text = Format(ReadRow.Item("SignDate"), "dd-MMM-yyyy")
                End If
                lblSignRemark1.Text = ReadRow.Item("SignRemark").ToString
                If ReadRow.Item("SignComplete").ToString = "1" Then
                    lblSignCompletion1.Text = "☑"
                Else
                    lblSignCompletion1.Text = ""
                End If
                lblSignCompletionBy1.Text = ReadRow.Item("SignCompleteByInitial").ToString
                'lblSignCompletionBy1.Text = ReadRow.Item("SignCompleteBy").ToString
                If ReadRow.Item("SignCompleteDate").ToString = "" Then
                    lblSignCompletionDate1.Text = ""
                Else
                    lblSignCompletionDate1.Text = Format(ReadRow.Item("SignCompleteDate"), "dd-MMM-yyyy")
                End If
                If ReadRow.Item("SNPDate").ToString = "" Then
                    lblSNPDate1.Text = ""
                Else
                    lblSNPDate1.Text = Format(ReadRow.Item("SNPDate"), "dd-MMM-yyyy")
                End If

                If ReadRow.Item("CollectDate").ToString = "" Then
                    lblCollectionDate1.Text = ""
                Else
                    lblCollectionDate1.Text = Format(ReadRow.Item("CollectDate"), "dd-MMM-yyyy")
                End If
                If IsDBNull(ReadRow.Item("CollectAmt")) Then
                    lblCollectedAmount1.Text = ""
                Else
                    lblCollectedAmount1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("CollectAmt"))
                End If
                lblCollectionRemark1.Text = ReadRow.Item("CollectRemark").ToString
                If ReadRow.Item("CollectComplete").ToString = "1" Then
                    lblCollectionCompletion1.Text = "☑"
                Else
                    lblCollectionCompletion1.Text = ""
                End If
                'lblCollectionCompletionBy1.Text = ReadRow.Item("CollectCompleteBy").ToString
                lblCollectionCompletionBy1.Text = ReadRow.Item("CollectCompleteByInitial").ToString
                If ReadRow.Item("CollectCompleteDate").ToString = "" Then
                    lblCollectionCompletionDate1.Text = ""
                Else
                    lblCollectionCompletionDate1.Text = Format(ReadRow.Item("CollectCompleteDate"), "dd-MMM-yyyy")
                End If

                If ReadRow.Item("UndoDate").ToString = "" Then
                    lblUndoDate1.Text = ""
                Else
                    lblUndoDate1.Text = Format(ReadRow.Item("UndoDate"), "dd-MMM-yyyy")
                End If
                lblUndoRemark1.Text = ReadRow.Item("UndoRemark").ToString
                If IsDBNull(ReadRow.Item("UndoAmt")) Then
                    lblUndoAmt1.Text = ""
                Else
                    lblUndoAmt1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoAmt"))
                End If
                'lblUndoBy1.Text = ReadRow.Item("UndoBy").ToString
                lblUndoBy1.Text = ReadRow.Item("UndoByInitial").ToString
                If IsDBNull(ReadRow.Item("UndoAgencyFee")) Then
                    lblUndoAgencyFee1.Text = ""
                Else
                    lblUndoAgencyFee1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoAgencyFee"))
                End If
                If IsDBNull(ReadRow.Item("UndoGST")) Then
                    lblUndoGST1.Text = ""
                Else
                    lblUndoGST1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoGST"))
                End If
                If ReadRow.Item("UndoGSTPaidBy").ToString = "1" Then
                    lblUndoGSTPaidBy1.Text = "Landlord"
                ElseIf ReadRow.Item("UndoGSTPaidBy").ToString = "2" Then
                    lblUndoGSTPaidBy1.Text = "Company"
                Else
                    lblUndoGSTPaidBy1.Text = ""
                End If
                If IsDBNull(ReadRow.Item("UndoListerAmt")) Then
                    lblUndoListerAmount1.Text = ""
                Else
                    lblUndoListerAmount1.Text = String.Format("{0:#,##0.00}", ReadRow.Item("UndoListerAmt"))
                End If
            Next

            If ddlTransaction2.SelectedValue <> Guid.Empty.ToString Then
                Comparison()
            End If
        End If

    End Sub

    Private Sub Comparison()
        'a4db90
        'General Information
        If lblAddress1.Text.ToUpper.Trim <> lblAddress2.Text.ToUpper.Trim Then
            trAddress.BgColor = "#A4DB90"
        End If

        If lblProject1.Text.ToUpper.Trim <> lblProject2.Text.ToUpper.Trim Then
            trProject.BgColor = "#A4DB90"
        End If

        If lblOpenFileRef1.Text.ToUpper.Trim <> lblOpenFileRef2.Text.ToUpper.Trim Then
            trOpenFileRef.BgColor = "#A4DB90"
        End If

        If lblClosedFileRef1.Text.ToUpper.Trim <> lblClosedFileRef2.Text.ToUpper.Trim Then
            trClosedFileRef.BgColor = "#A4DB90"
        End If

        If lblInvoiceNum1.Text.ToUpper.Trim <> lblInvoiceNum2.Text.ToUpper.Trim Then
            trInvoiceNum.BgColor = "#A4DB90"
        End If

        If lblTransactAs1.Text.ToUpper.Trim <> lblTransactAs2.Text.ToUpper.Trim Then
            trTransactAs.BgColor = "#A4DB90"
        End If

        If lblTransactedPrice1.Text.ToUpper.Trim <> lblTransactedPrice2.Text.ToUpper.Trim Then
            trTransactedPrice.BgColor = "#A4DB90"
        End If

        If lblDeposit1.Text.ToUpper.Trim <> lblDeposit2.Text.ToUpper.Trim Then
            trDeposit.BgColor = "#A4DB90"
        End If

        If lblPaymentType1.Text.ToUpper.Trim <> lblPaymentType2.Text.ToUpper.Trim Then
            trPaymentType.BgColor = "#A4DB90"
        End If

        If lblPaymentDate1.Text.ToUpper.Trim <> lblPaymentDate2.Text.ToUpper.Trim Then
            trPaymentDate.BgColor = "#A4DB90"
        End If

        If lblRequisition1.Text.ToUpper.Trim <> lblRequisition2.Text.ToUpper.Trim Then
            trRequisition.BgColor = "#A4DB90"
        End If

        If lblStatus1.Text.ToUpper.Trim <> lblStatus2.Text.ToUpper.Trim Then
            trStatus.BgColor = "#A4DB90"
        End If

        If lblVendorType1.Text.ToUpper.Trim <> lblVendorType2.Text.ToUpper.Trim Then
            trVendorType.BgColor = "#A4DB90"
        End If

        If lblVendorName11.Text.ToUpper.Trim <> lblVendorName12.Text.ToUpper.Trim Then
            trVendorName1.BgColor = "#A4DB90"
        End If

        If lblVendorName21.Text.ToUpper.Trim <> lblVendorName22.Text.ToUpper.Trim Then
            trVendorName2.BgColor = "#A4DB90"
        End If

        If lblVendorName31.Text.ToUpper.Trim <> lblVendorName32.Text.ToUpper.Trim Then
            trVendorName3.BgColor = "#A4DB90"
        End If

        If lblVendorNRIC11.Text.ToUpper.Trim <> lblVendorNRIC12.Text.ToUpper.Trim Then
            trVendorNRIC1.BgColor = "#A4DB90"
        End If

        If lblVendorNRIC21.Text.ToUpper.Trim <> lblVendorNRIC22.Text.ToUpper.Trim Then
            trVendorNRIC2.BgColor = "#A4DB90"
        End If

        If lblVendorNRIC31.Text.ToUpper.Trim <> lblVendorNRIC32.Text.ToUpper.Trim Then
            trVendorNRIC3.BgColor = "#A4DB90"
        End If

        If lblVendorCompany1.Text.ToUpper.Trim <> lblVendorCompany2.Text.ToUpper.Trim Then
            trVendorCompany.BgColor = "#A4DB90"
        End If

        If lblVendorCompanyNo1.Text.ToUpper.Trim <> lblVendorCompanyNo2.Text.ToUpper.Trim Then
            trVendorCompanyNo.BgColor = "#A4DB90"
        End If

        If lblVendorContactPerson1.Text.ToUpper.Trim <> lblVendorContactPerson2.Text.ToUpper.Trim Then
            trVendorContactPerson.BgColor = "#A4DB90"
        End If

        If lblVendorAddress1.Text.ToUpper.Trim <> lblVendorAddress2.Text.ToUpper.Trim Then
            trVendorAddress.BgColor = "#A4DB90"
        End If

        If lblVendorPhone1.Text.ToUpper.Trim <> lblVendorPhone2.Text.ToUpper.Trim Then
            trVendorPhone.BgColor = "#A4DB90"
        End If

        If lblVendorMobile1.Text.ToUpper.Trim <> lblVendorMobile2.Text.ToUpper.Trim Then
            trVendorMoible.BgColor = "#A4DB90"
        End If

        If lblVendorFax1.Text.ToUpper.Trim <> lblVendorFax2.Text.ToUpper.Trim Then
            trVendorFax.BgColor = "#A4DB90"
        End If

        If lblVendorEmail1.Text.ToUpper.Trim <> lblVendorEmail2.Text.ToUpper.Trim Then
            trVendorEmail.BgColor = "#A4DB90"
        End If

        If lblVendorReferral1.Text.ToUpper.Trim <> lblVendorReferral2.Text.ToUpper.Trim Then
            trVendorReferral.BgColor = "#A4DB90"
        End If

        If lblVendorReferralName1.Text.ToUpper.Trim <> lblVendorReferralName2.Text.ToUpper.Trim Then
            trVendorReferralName.BgColor = "#A4DB90"
        End If

        If lblVendorReferralNRIC1.Text.ToUpper.Trim <> lblVendorReferralNRIC2.Text.ToUpper.Trim Then
            trVendorReferralNRIC.BgColor = "#A4DB90"
        End If

        If lblVendorReferralContact1.Text.ToUpper.Trim <> lblVendorReferralContact2.Text.ToUpper.Trim Then
            trVendorReferralContact.BgColor = "#A4DB90"
        End If

        If lblVendorReferralStatus1.Text.ToUpper.Trim <> lblVendorReferralStatus2.Text.ToUpper.Trim Then
            trVendorReferralStatus.BgColor = "#A4DB90"
        End If

        If lblVendorReferralAmount1.Text.ToUpper.Trim <> lblVendorReferralAmount2.Text.ToUpper.Trim Then
            trVendorReferralAmount.BgColor = "#A4DB90"
        End If

        If lblVendorSolicitorCompany1.Text.ToUpper.Trim <> lblVendorSolicitorCompany2.Text.ToUpper.Trim Then
            trVendorReferralAmount.BgColor = "#A4DB90"
        End If

        If lblVendorSolicitorName1.Text.ToUpper.Trim <> lblVendorSolicitorName2.Text.ToUpper.Trim Then
            trVendorSolicitorName.BgColor = "#A4DB90"
        End If

        If lblVendorSolicitorEmail1.Text.ToUpper.Trim <> lblVendorSolicitorEmail2.Text.ToUpper.Trim Then
            trVendorSolicitorEmail.BgColor = "#A4DB90"
        End If

        If lblVendorSolicitorAddress1.Text.ToUpper.Trim <> lblVendorSolicitorAddress2.Text.ToUpper.Trim Then
            trVendorSolicitorAddress.BgColor = "#A4DB90"
        End If

        If lblVendorSolicitorPhone1.Text.ToUpper.Trim <> lblVendorSolicitorPhone2.Text.ToUpper.Trim Then
            trVendorSolicitorPhone.BgColor = "#A4DB90"
        End If

        If lblVendorSolicitorFax1.Text.ToUpper.Trim <> lblVendorSolicitorFax2.Text.ToUpper.Trim Then
            trVendorSolicitorFax.BgColor = "#A4DB90"
        End If

        If lblAgencyFee1.Text.ToUpper.Trim <> lblAgencyFee2.Text.ToUpper.Trim Then
            trAgencyFee.BgColor = "#A4DB90"
        End If

        If lblGSTPaidBy1.Text.ToUpper.Trim <> lblGSTPaidBy2.Text.ToUpper.Trim Then
            trGSTPaidBy.BgColor = "#A4DB90"
        End If

        If lblGST1.Text.ToUpper.Trim <> lblGST2.Text.ToUpper.Trim Then
            trGST.BgColor = "#A4DB90"
        End If

        If lblListing1.Text.ToUpper.Trim <> lblListing2.Text.ToUpper.Trim Then
            trListing.BgColor = "#A4DB90"
        End If

        If lblPurchaserType1.Text.ToUpper.Trim <> lblPurchaserType2.Text.ToUpper.Trim Then
            trPurchaseType.BgColor = "#A4DB90"
        End If

        If lblPurchaserName11.Text.ToUpper.Trim <> lblPurchaserName12.Text.ToUpper.Trim Then
            trPurchaserName1.BgColor = "#A4DB90"
        End If

        If lblPurchaserName21.Text.ToUpper.Trim <> lblPurchaserName22.Text.ToUpper.Trim Then
            trPurchaserName2.BgColor = "#A4DB90"
        End If

        If lblPurchaserName31.Text.ToUpper.Trim <> lblPurchaserName32.Text.ToUpper.Trim Then
            trPurchaserName3.BgColor = "#A4DB90"
        End If

        If lblPurchaserNRIC11.Text.ToUpper.Trim <> lblPurchaserNRIC12.Text.ToUpper.Trim Then
            trPurchaserNRIC1.BgColor = "#A4DB90"
        End If

        If lblPurchaserNRIC21.Text.ToUpper.Trim <> lblPurchaserNRIC22.Text.ToUpper.Trim Then
            trPurchaserNRIC2.BgColor = "#A4DB90"
        End If

        If lblPurchaserNRIC31.Text.ToUpper.Trim <> lblPurchaserNRIC32.Text.ToUpper.Trim Then
            trPurchaserNRIC3.BgColor = "#A4DB90"
        End If

        If lblPurchaserCompany1.Text.ToUpper.Trim <> lblPurchaserCompany2.Text.ToUpper.Trim Then
            trPurchaserCompany.BgColor = "#A4DB90"
        End If

        If lblPurchaserCompanyNo1.Text.ToUpper.Trim <> lblPurchaserCompanyNo2.Text.ToUpper.Trim Then
            trPurchaserCompanyNo.BgColor = "#A4DB90"
        End If

        If lblPurchaserContactPerson1.Text.ToUpper.Trim <> lblPurchaserContactPerson2.Text.ToUpper.Trim Then
            trPurchaserContactPerson.BgColor = "#A4DB90"
        End If

        If lblPurchaserAddress1.Text.ToUpper.Trim <> lblPurchaserAddress2.Text.ToUpper.Trim Then
            trPurchaserAddress.BgColor = "#A4DB90"
        End If

        If lblPurchaserPhone1.Text.ToUpper.Trim <> lblPurchaserPhone2.Text.ToUpper.Trim Then
            trPurchaserPhone.BgColor = "#A4DB90"
        End If

        If lblPurchaserMobile1.Text.ToUpper.Trim <> lblPurchaserMobile2.Text.ToUpper.Trim Then
            trPuchaserMobile.BgColor = "#A4DB90"
        End If

        If lblPurchaserFax1.Text.ToUpper.Trim <> lblPurchaserFax2.Text.ToUpper.Trim Then
            trPurchaserFax.BgColor = "#A4DB90"
        End If

        If lblPurchaserEmail1.Text.ToUpper.Trim <> lblPurchaserEmail2.Text.ToUpper.Trim Then
            trPurchaserEmail.BgColor = "#A4DB90"
        End If

        If lblPurchaserReferral1.Text.ToUpper.Trim <> lblPurchaserReferral2.Text.ToUpper.Trim Then
            trPurchaserReferral.BgColor = "#A4DB90"
        End If

        If lblPurchaserReferralName1.Text.ToUpper.Trim <> lblPurchaserReferralName2.Text.ToUpper.Trim Then
            trPurchaserReferralName.BgColor = "#A4DB90"
        End If

        If lblPurchaserReferralNRIC1.Text.ToUpper.Trim <> lblPurchaserReferralNRIC2.Text.ToUpper.Trim Then
            trPurchaserReferralNRIC.BgColor = "#A4DB90"
        End If

        If lblPurchaserReferralContact1.Text.ToUpper.Trim <> lblPurchaserReferralContact2.Text.ToUpper.Trim Then
            trPurchaserReferralContact.BgColor = "#A4DB90"
        End If

        If lblPurchaserReferralStatus1.Text.ToUpper.Trim <> lblPurchaserReferralStatus2.Text.ToUpper.Trim Then
            trPurchaserReferralStatus.BgColor = "#A4DB90"
        End If

        If lblPurchaserReferralAmount1.Text.ToUpper.Trim <> lblPurchaserReferralAmount2.Text.ToUpper.Trim Then
            trPurchaserReferralAmount.BgColor = "#A4DB90"
        End If

        If lblPurchaserSolicitorCompany1.Text.ToUpper.Trim <> lblPurchaserSolicitorCompany2.Text.ToUpper.Trim Then
            trPurchaserSolicitorCompany.BgColor = "#A4DB90"
        End If

        If lblPurchaserSolicitorName1.Text.ToUpper.Trim <> lblPurchaserSolicitorName2.Text.ToUpper.Trim Then
            trPurchaserSolicitorName.BgColor = "#A4DB90"
        End If

        If lblPurchaserSolicitorEmail1.Text.ToUpper.Trim <> lblPurchaserSolicitorEmail2.Text.ToUpper.Trim Then
            trPurchaserSolicitorEmail.BgColor = "#A4DB90"
        End If

        If lblPurchaserSolicitorAddress1.Text.ToUpper.Trim <> lblPurchaserSolicitorAddress2.Text.ToUpper.Trim Then
            trPurchaserSolicitorAddress.BgColor = "#A4DB90"
        End If

        If lblPurchaserSolicitorPhone1.Text.ToUpper.Trim <> lblPurchaserSolicitorPhone2.Text.ToUpper.Trim Then
            trPurchaserSolicitorPhone.BgColor = "#A4DB90"
        End If

        If lblPurchaserSolicitorFax1.Text.ToUpper.Trim <> lblPurchaserSolicitorFax2.Text.ToUpper.Trim Then
            trPurchaserSolicitorFax.BgColor = "#A4DB90"
        End If

        If lblDisbursementFee1.Text.ToUpper.Trim <> lblDisbursementFee2.Text.ToUpper.Trim Then
            trDisbursementFee.BgColor = "#A4DB90"
        End If

        If lblSignDate1.Text.ToUpper.Trim <> lblSignDate2.Text.ToUpper.Trim Then
            trSignDate.BgColor = "#A4DB90"
        End If

        If lblSignRemark1.Text.ToUpper.Trim <> lblSignRemark2.Text.ToUpper.Trim Then
            trSignRemark.BgColor = "#A4DB90"
        End If

        If lblSignCompletion1.Text.ToUpper.Trim <> lblSignCompletion2.Text.ToUpper.Trim Then
            trSignCompletion.BgColor = "#A4DB90"
        End If

        If lblSignCompletionBy1.Text.ToUpper.Trim <> lblSignCompletionBy2.Text.ToUpper.Trim Then
            trSignCompleteBy.BgColor = "#A4DB90"
        End If

        If lblSignCompletionDate1.Text.ToUpper.Trim <> lblSignCompletionDate2.Text.ToUpper.Trim Then
            trSignCompleteDate.BgColor = "#A4DB90"
        End If

        If lblSNPDate1.Text.ToUpper.Trim <> lblSNPDate2.Text.ToUpper.Trim Then
            trSNPDate.BgColor = "#A4DB90"
        End If

        If lblCollectionDate1.Text.ToUpper.Trim <> lblCollectionDate2.Text.ToUpper.Trim Then
            trCollectDate.BgColor = "#A4DB90"
        End If

        If lblCollectedAmount1.Text.ToUpper.Trim <> lblCollectedAmount2.Text.ToUpper.Trim Then
            trCollectionAmt.BgColor = "#A4DB90"
        End If

        If lblCollectionRemark1.Text.ToUpper.Trim <> lblCollectionRemark2.Text.ToUpper.Trim Then
            trCollectionRemark.BgColor = "#A4DB90"
        End If

        If lblCollectionCompletion1.Text.ToUpper.Trim <> lblCollectionCompletion2.Text.ToUpper.Trim Then
            trCollectionCompletion.BgColor = "#A4DB90"
        End If

        If lblCollectionCompletionBy1.Text.ToUpper.Trim <> lblCollectionCompletion2.Text.ToUpper.Trim Then
            trCollectionCompletionBy.BgColor = "#A4DB90"
        End If

        If lblCollectionCompletionDate1.Text.ToUpper.Trim <> lblCollectionCompletionDate2.Text.ToUpper.Trim Then
            trCollectionCompletionDate.BgColor = "#A4DB90"
        End If

        If lblUndoDate1.Text.ToUpper.Trim <> lblUndoDate2.Text.ToUpper.Trim Then
            trUndoDate.BgColor = "#A4DB90"
        End If

        If lblUndoRemark1.Text.ToUpper.Trim <> lblUndoRemark2.Text.ToUpper.Trim Then
            trUndoRemark.BgColor = "#A4DB90"
        End If

        If lblUndoAmt1.Text.ToUpper.Trim <> lblUndoAmt2.Text.ToUpper.Trim Then
            trUndoAmt.BgColor = "#A4DB90"
        End If

        If lblUndoBy1.Text.ToUpper.Trim <> lblUndoBy2.Text.ToUpper.Trim Then
            trUndoBy.BgColor = "#A4DB90"
        End If

        If lblUndoAgencyFee1.Text.ToUpper.Trim <> lblUndoAgencyFee2.Text.ToUpper.Trim Then
            trUndoAgencyFee.BgColor = "#A4DB90"
        End If

        If lblUndoGST1.Text.ToUpper.Trim <> lblUndoGST2.Text.ToUpper.Trim Then
            trUndoGST.BgColor = "#A4DB90"
        End If

        If lblUndoGSTPaidBy1.Text.ToUpper.Trim <> lblUndoGSTPaidBy2.Text.ToUpper.Trim Then
            trUndoGSTPaidBy.BgColor = "#A4DB90"
        End If

        If lblUndoListerAmount1.Text.ToUpper.Trim <> lblUndoListerAmount2.Text.ToUpper.Trim Then
            trUndoListerAmount.BgColor = "#A4DB90"
        End If
    End Sub

    Protected Sub btnBack_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBack.Click
        If Session("Back") Is Nothing Then
            Response.Redirect("translist.aspx")
        Else
            Dim strBack As String = Session("Back").ToString
            Dim arr() As String = strBack.Split("ڡ")
            Response.Redirect(arr(0).ToString)
        End If
    End Sub
End Class
